#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@File Name: 两个序列的集合操作_inter1.py
@Author: LT
@Date: 2021/9/27 14:30
# -----------------------------------------------------------------------------------------------------
@Description: 
write here
# -----------------------------------------------------------------------------------------------------
"""


def intersect(seq1, seq2):
    """交集"""
    res = []                          # 先创建一个空列表
    for x in seq1:                    # 遍历第一个序列
        if x in seq2:
            res.append(x)             # 把相同的元素添加到res列表里
    return res


def union(seq1, seq2):
    """并集"""
    res = list(seq1)                  # 先复制seq1
    for x in seq2:                    # 再把seq2中新元素加入到res里
        if x not in res:
            res.append(x)
    return res


if __name__ == '__main__':
    pass
